
<include file="public@header" />
</head>
<body>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('/company/admin_qa/index')}">所有咨询</a></li>
		<li class="active"><a>咨询回复</a></li>
	</ul>


	<table class="table table-hover table-bordered">
		<thead>
		<tr>
			<th>序号</th>
			<th>状态</th>
			<th>时间</th>
			<th>所在群</th>
			<th>内容</th>
		</tr>
		</thead>
		<tbody>

		<foreach name="qa_list" item="vo" key="k">
			<tr>
				<td>{$k+1}</td>
				</td>
				<td>{$vo.status_name}</td>
				<td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
				<td>{$vo['group_name']}</td>
				<td>{$vo['description']}</td>
			</tr>
		</foreach>
		</tbody>
	</table>

	<form method="post" class="form-horizontal margin-top-20  js-ajax-form" action="{:url('/company/admin_qa/replyPost')}">

		<div class="form-group">
			<label for="title" class="col-sm-2 control-label"><span class="form-required">*</span>标题</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="title" name="post[title]" value="回复：{$post['title']}">
			</div>


		</div>


		<div class="form-group">
			<label for="type_id" class="col-sm-2 control-label"><span class="form-required">*</span>类型</label>
			<div class="col-md-2 col-sm-10">
				<select class="form-control" id="type_id" name="post[type_id]" >

					<php>

						$qaType = config('qa_type');

						foreach ($qaType as $key=>$value) {

						$selected="";
						if($key==$post['type_id']){
						$selected="selected";
						}

						echo "<option value='$key' $selected>$value</option>";
						}

					</php>


				</select>
				<input type="hidden" id="type_name" name="post[type_name]"  value="{$post['type_name']}">
			</div>

			<label for="category_id" class="col-sm-2 control-label"><span class="form-required">*</span>分类</label>
			<div class="col-md-2 col-sm-10">
				<select class="form-control" id="category_id" name="post[category_id]" >


					<volist name="qa_category" id="vo">
						<php>
							$selected="";
							if($vo->id==$post['category_id']){
							$selected="selected";
							}
						</php>
						<option value="{$vo.id}" {$selected}>{$vo.name}</option>
					</volist>


				</select>
				<input type="hidden" id="category_name" name="post[category_name]"  value="{$post['category_name']}">
			</div>

		</div>

		<div class="form-group">
			<label for="company_id" class="col-sm-2 control-label">所属企业</label>
			<div class="col-md-6 col-sm-10">
				<select class="form-control" id="company_id" name="post[company_id]" >
					<option value=""  data-text="">请选择</option>
					<volist name="company_list" id="vo">
						<php>
							$selected="";
							if($vo->id==$post['company_id']){
							$selected="selected";
							}
						</php>
						<option value="{$vo.id}" {$selected}>{$vo.name}</option>
					</volist>
				</select>

				<input type="hidden" id="company_name" name="post[company_name]"  value="{$post['company_name']}">
			</div>


		</div>


		<div class="form-group">

			<label for="category_id" class="col-sm-2 control-label">所属群</label>
			<div class="col-md-2 col-sm-10">

				<select class="form-control" id="group_id" name="post[group_id]" >



					<volist name="member_group" id="vo">
						<php>
							$selected="";
							if($vo->id==$post['group_id']){
							$selected="selected";
							}
						</php>
						<option value="{$vo.id}"  data-text="{$vo.name}" {$selected}>{$vo.name}</option>
					</volist>

				</select>

				<input type="hidden" id="group_name" name="post[group_name]"  value="{$post['group_name']}">
			</div>


			<label for="status_id" class="col-sm-2 control-label"><span class="form-required">*</span>状态</label>
			<div class="col-md-2 col-sm-10">
				<select class="form-control" id="status_id" name="post[status_id]" >
					<volist name="qa_status" id="vo">
						<php>
							$selected="";
							if($vo->id==$post['status_id']){
							$selected="selected";
							}
						</php>
						<option value="{$vo.id}" {$selected}>{$vo.name}</option>
					</volist>
				</select>

				<input type="hidden" id="status_name" name="post[status_name]"  value="{$post['status_name']}">
			</div>


		</div>



		<div class="form-group">
			<label for="person_name" class="col-sm-2 control-label"><span class="form-required">*</span>联系人</label>
			<div class="col-md-2 col-sm-10">
				<input type="text" class="form-control" id="person_name" name="post[person_name]" value="{$member['name']}">
			</div>

			<label for="person_phone" class="col-sm-2 control-label"><span class="form-required">*</span>联系电话</label>
			<div class="col-md-2 col-sm-10">
				<input type="text" class="form-control" id="person_phone" name="post[person_phone]" value="{$user['mobile']}">
			</div>
		</div>

		<div class="form-group">

			<label for="wx_account" class="col-sm-2 control-label">微信</label>
			<div class="col-md-2 col-sm-10">
				<input type="text" class="form-control" id="wx_account" name="post[wx_account]" value="{$member['wx_account']}">
			</div>


			<label for="person_email" class="col-sm-2 control-label">邮箱</label>
			<div class="col-md-2 col-sm-10">
				<input type="text" class="form-control" id="person_email" name="post[person_email]" value="{$user['user_email']}">
			</div>


		</div>


		<div class="form-group">
			<label for="description" class="col-sm-2 control-label"><span class="form-required">*</span>问题描述</label>
			<div class="col-md-6 col-sm-10">
					<textarea class="form-control" name="post[description]" id="description" style="height: 50px;"
							  placeholder="请填写问题描述">{$post['description']}</textarea>
			</div>
		</div>


		<div class="form-group">
			<label   class="col-sm-2 control-label">问题附件</label>

			<div class="col-md-6 col-sm-10">
				<ul id="files" class="pic-list list-unstyled form-inline">
					<notempty name="post.more.files">
						<foreach name="post.more.files" item="vo">
							<php>$file_url=cmf_get_file_download_url($vo['url']);</php>
							<li id="saved-file{$key}">
								<input id="file-{$key}" type="hidden" name="file_urls[]"
									   value="{$vo.url}">
								<input class="form-control" id="file-{$key}-name" type="text"
									   name="file_names[]"
									   value="{$vo.name}" style="width: 200px;" title="图片名称">
								<a id="file-{$key}-preview" href="{$file_url}" target="_blank">下载</a>
								<a href="javascript:uploadOne('文件上传','#file-{$key}','file');">替换</a>
								<a href="javascript:(function(){$('#saved-file{$key}').remove();})();">移除</a>
							</li>
						</foreach>
					</notempty>
				</ul>
				<a href="javascript:uploadMultiImage('附件上传','#files','files-item-tpl');"
				   class="btn btn-sm btn-default">选择文件</a>
			</div>
		</div>



		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="post[parent_id]"  value="{$post['id']}" />
				<input type="hidden" name="post[user_id]"  value="{$Think.session.user.id}" />

				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
				<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
			</div>
		</div>
	</form>
</div>

<link rel="stylesheet" href="__STATIC__/js/select2/css/select2.min.css">

<script src="__STATIC__/js/select2/js/select2pinyin.js?v=201802271547"></script>

<script type="text/html" id="files-item-tpl">
	<li id="saved-file{id}">
		<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
		<input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
			   style="width: 200px;" title="文件名称">
		<a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
		<a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
		<a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
	</li>
</script>


<script>
    $(function () {
        var $company_id = $("#company_id");
        var $group_id = $("#group_id");
        $group_id.select2();
        $company_id.select2();
    });

    $("form").submit(function(e){

        $("#company_name").val($("#company_id").find("option:selected").text());
        $("#group_name").val($("#group_id").find("option:selected").text());
        $("#category_name").val($("#category_id").find("option:selected").text());
        $("#status_name").val($("#status_id").find("option:selected").text());
        $("#type_name").val($("#type_id").find("option:selected").text());

        //return false;
    });


</script>

<script src="__STATIC__/js/admin.js"></script>
</body>
</html>